import { ProLayout } from "@ant-design/pro-components";
import { Link } from "react-router-dom";
import routes from "./route";

export default function Layout(props) {

  const menuDataList = routes.filter(i => i.layout !== false).map(i => ({
    path: i.path,
    name: i.name
  }))

  return (
    <ProLayout
      menuDataRender={() => menuDataList}
      menuItemRender={(item, dom) => <Link to={item.path}>{dom}</Link>}
    >
      {props.children}
    </ProLayout>
  );
}